package com.anji.hyperneat.modular;

/**
 * Input Mapper intended to provide an input for deltas between two sets of coordinates. 
 * @author slusk
 *
 */
public class CoordinateDeltaInputMapper extends FloatArrayInputMapper {

	/**
	 * Constructor.
	 * @param minVal The minimum possible value of any delta; since this class works with normalized coordinates, this should probably be -1 
	 * @param maxVal The maximum possible value of any delta; since this class works with normalized coordinates, this should probably be 1
	 */
	public CoordinateDeltaInputMapper(int dims, float minVal, float maxVal) {
		super(dims, minVal, maxVal);
	}
	
	/**
	 * Provide normalized coordinate values to populate this mapper's values
	 * @param tgtVals Normalized target node values
	 * @param srcVals Normalized source node values
	 */
	public void populateValues(float[] tgtVals, float[] srcVals) {
		vals = new float[tgtVals.length];
		for (int i = 0; i < tgtVals.length; i++) {	// Assume tgt & src have same lenght; should be same as Max dimensions 
			vals[i] = srcVals[i] - tgtVals[i];	// Coleman's original implementation uses src - tgt; copied here, not sure if this is how it should be or not.
		}
	}

}
